package org.familysearch.fsapi.gwt.services.client;

import org.familysearch.fsapi.gwt.common.client.entities.Person;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public class PersonServiceProxy {

    private static PersonServiceProxy instance;
    private PersonServiceAsync proxy;

    private PersonServiceProxy()
    {
        proxy = (PersonServiceAsync) GWT
                .create(PersonService.class);
        ((ServiceDefTarget) proxy).setServiceEntryPoint(GWT.getModuleBaseURL()
                + "PersonService");
    }

    public static PersonServiceProxy get()
    {
        if (instance == null) {
            instance = new PersonServiceProxy();
        }
        return instance;
    }
    
    public void getPerson(Person person, AsyncCallback callback) 
    {
    	proxy.getPerson(person, callback);
    }
}
